from APP import create_app,socketio
from threading import Thread
from InfluxDB_setting.client_test import main as client_main

app = create_app()

def run_client():
    # 为后台线程创建独立的应用上下文
    with app.app_context():
        client_main()


if __name__ == '__main__':
    
    #启动监控客户端线程
    Thread(target=run_client, daemon=True).start()


    # 使用SocketIO启动服务
   #  socketio.run(APP,  port=5000, debug=True, allow_unsafe_werkzeug=True)
    socketio.run(app, host='0.0.0.0', port=5000, debug=True, allow_unsafe_werkzeug=True)